﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ResqustOkWithMenu.ascx.cs"
    Inherits="com.cngrain.SAFC.Web.res.inc.ResqustOkWithMenu" %>
<link href="<%=com.cngrain.SAFC.Common.CommonSet.BaseUrl()+"/res/css/popup/popup.css"%>"
    rel="stylesheet" type="text/css" />

<script src="<%=com.cngrain.SAFC.Common.CommonSet.BaseUrl()%>/res/js/common/common.js"
    type="text/javascript"></script>

<script src="<%=com.cngrain.SAFC.Common.CommonSet.BaseUrl()%>/res/js/common/Dialog.js"
    type="text/javascript"></script>

<div class="popsafe popmodule" id="IssueSuccess" style="display: none; position: absolute;
    z-index: 10001;">
    <h1 id="ShowText">
        提示标题
    </h1>
    <h2 id="ShowHtml">
        提示内容
    </h2>
    <h3>
        <a id="ReturnUrl" href="#">返 回</a><a id="CloseUrl" onclick="msgdialog.Hide();" href="javascript:void(0);">关
            闭</a>
    </h3>
</div>

<script type="text/javascript">
    var msgdialog = new Dialog("IssueSuccess", null, 140, '500');
    var MenuCode = '';

    //初始化内容SuccessInit('#','添加成功！','添加一条记录','返回','003001','')
    function SuccessInit(defUrl, showText, showHtml, aText, iMenuCode, closeUrl) {
        if (typeof (iMenuCode) != 'undefined' && iMenuCode != '') {
            MenuCode = iMenuCode;
            setEvent();
        }
        else {
            document.getElementById('ReturnUrl').href = defUrl;
        }
        document.getElementById('ReturnUrl').innerHTML = aText;
        document.getElementById('ShowText').innerHTML = showText;
        document.getElementById('ShowHtml').innerHTML = showHtml;
        if (typeof (closeUrl) != 'undefined' && closeUrl != '') {
            document.getElementById('CloseUrl').href = closeUrl;
        }
        else {
            document.getElementById('CloseUrl').href = 'javascript:void(0);';
        }
        msgdialog.ShowAndMask();
    }
    function openMenuById() {
        msgdialog.Hide();
        openMenuById1();
    }

    function openMenuById1() {
        //alert(MenuCode);
        var n = window.top.center.getComponent(MenuCode);
        var node = window.top.treenode.getNodeById(MenuCode);
        var ifmu = false;
        try {
            eval('ifmu=menu' + MenuCode + ';');
        }
        catch (e) {
            ifmu = false;
        }
        //alert(ifmu);
        if (node != null) {
            if (n) { //判断是否已经打开该面板
                window.top.center.remove(n);
            }
            n = window.top.center.add({
                xtype: "panel",
                id: node.id,
                iconCls: node.attributes.iconCls,
                title: node.attributes.pagetext,
                closable: true,  //通过html载入目标页
                html: '<iframe scrolling="auto" frameborder="0" width="100%" height="100%" src='
                            + (node.attributes.url.indexOf('?') > 0 ? node.attributes.url + '&' : node.attributes.url + '?') + 'MenuCode=' + node.id + '&remind=true' + '></iframe>'
            });
            window.top.center.setActiveTab(n);
        }
        else {
            node = window.top.treenode.getNodeById(MenuCode.substring(0, 3));

            if (node != null && !ifmu) {
                //node.select();
                //debugger;
                node.expand(false, true, function() { eval('menu' + MenuCode + '=true;'); openMenuById1(); });
                //openPanelWithMenu(MenuCode);
            }
            else {
                node = window.top.treenode.getNodeById(MenuCode.substring(0, 6));
                if (node != null) {
                    node.expand(false, true, function() { eval('menu' + MenuCode + '=true;'); openMenuById1(); });
                }
            }
        }
    }
    function setEvent() {
        var obj = document.getElementById("ReturnUrl");
        obj.href = 'javascript:void(0);';

        if (window.addEventListener) {
            //其他浏览器的事件代码: Mozilla, Netscape, Firefox
            //添加的事件的顺序即执行顺序 //注意用 addEventListener 添加带on的事件，不用加on
            obj.addEventListener('click', openMenuById, false);
        }
        else {
            //IE 的事件代码 在原先事件上添加 add 方法
            obj.attachEvent('onclick', openMenuById);
        }
    }

</script>

